package com.peng.design.acyclicvisitor.acceptable;

import com.peng.design.acyclicvisitor.HayesVisitor;
import com.peng.design.acyclicvisitor.Visitor;
import lombok.extern.slf4j.Slf4j;

/**
 * Hayes
 *
 * @author: lupeng10
 * @create: 2023-04-28 10:27
 */
@Slf4j
public class Hayes implements AcceptAble {

    @Override
    public void accept(Visitor visitor) {
        if (visitor instanceof HayesVisitor) {
            ((HayesVisitor) visitor).visit(this);
        } else {
            log.info("只有 HayesVisitor 允许访问 Hayes");
        }
    }

    @Override
    public String toString() {
        return "Hayes";
    }
}
